{% extends "base_generic.html" %}
{% load i18n %}

{% block content %}
    <h1>{% trans "Author List" %}</h1>

    {% if author_list %}
    <ul>

      {% for author in author_list %}
      <li>
        <a href="{{ author.get_absolute_url }}">{{ author.first_name }} {{ author.last_name }}</a> ({{author.date_of_birth}} - {% if author.date_of_death %}{{author.date_of_death}}{% endif %})
      </li>
      {% endfor %}

    </ul>
    <nav aria-label="Page navigation" class="mt-4">
          <ul class="pagination justify-content-center">
              {% if page_obj.has_previous %}
                  <li class="page-item"><a class="page-link" href="?page={{ page_obj.previous_page_number }}&sort={{ sort }}&order={{ order }}">{% trans "Previous" %}</a></li>
              {% endif %}
              <li class="page-item disabled"><span class="page-link">{% trans "Page" %} {{ page_obj.number }} {% trans "of" %} {{ page_obj.paginator.num_pages }}</span></li>
              {% if page_obj.has_next %}
                  <li class="page-item"><a class="page-link" href="?page={{ page_obj.next_page_number }}&sort={{ sort }}&order={{ order }}">{% trans "Next" %}</a></li>
              {% endif %}
          </ul>
      </nav>
    {% else %}
      <p>{% trans "There are no authors available." %}</p>
    {% endif %}
{% endblock %} 